﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace Query2Object
{
    /// <summary>
    /// load config item from add node
    /// 从add节点获取配置的属性项
    /// </summary>
    public class ConnectionItem:ConfigurationElement
    {
        private static ConfigurationPropertyCollection _propertylist;

        private static ConfigurationProperty _Name;

        private static ConfigurationProperty _ConnectionString;

        private static ConfigurationProperty _Type;

        static ConnectionItem()
        {
            _propertylist = new ConfigurationPropertyCollection();
            _Name = new ConfigurationProperty("name", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            _ConnectionString = new ConfigurationProperty("connectionstring", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            _Type = new ConfigurationProperty("dbtype", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            _propertylist.Add(_Name);
            _propertylist.Add(_ConnectionString);
            _propertylist.Add(_Type);
        }

        public string name
        {
            get { return (string)base[_Name]; }
            set { base[_Name] = value; }
        }
        public string connectionstring
        {
            get { return (string)base[_ConnectionString]; }
            set { base[_ConnectionString]=value; }
        }
        public string dbtype
        {
            get { return (string)base[_Type]; }
            set { base[_Type] = value; }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get { return _propertylist; }
        }

    }
}
